﻿using System;

namespace ComputerVision.BaseForm
{
    public partial class frmSearch : frmObject
    {
        protected int Id = 0;

        public frmSearch()
        {
            InitializeComponent();
        }

        #region Add

        /// <summary>
        /// Thêm mới
        /// </summary>
        protected virtual void Add()
        {
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                Add();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }

        #endregion

        #region LoadData

        /// <summary>
        ///Ham load data ra cac control 
        /// </summary>
        protected virtual void LoadData()
        {
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            LoadData();
        }

        private void frmSearch_Load(object sender, EventArgs e)
        {
            LoadData();
        }
        #endregion

        #region Edit

        protected virtual void Edit()
        {
        }

        private void btnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                Edit();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }

        #endregion

        #region Delete

        /// <summary>
        /// Xoa
        /// </summary>
        protected virtual void Delete()
        {
        }

        private void btnDel_Click(object sender, EventArgs e)
        {
            try
            {
                Delete();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }

        #endregion

        
    }
}
